<?php
/** @var Dingo\Api\Routing\Router $api */
$api->group([
    'version' => 'v1',
    'namespace' => 'App\Http\Controllers\Finance',
    'prefix' => 'api/finance',
], function ($api) {
    $api->post('auth', 'AuthController@store'); // 账号密码获取验证码
    $api->post('auth/confirm', 'AuthController@confirm'); // 验证码获取 token
    $api->group(['prefix' => 'notify'], function () use ($api) {
        $api->post('/fzt_wechat', 'NotifyController@fztWechat'); // 分账通微信支付 异步回调通知
        $api->post('/fzt_cashier', 'NotifyController@fztCashier'); // 分账通银行快捷支付 (收银台) 异步回调通知
        $api->post('/sd_wechat', 'SdNotifyController@sdWechat'); // 杉德微信支付 异步回调通知
        $api->post('/ums_wechat', 'UmsNotifyController@umsWechat'); // 银联商务微信支付 异步回调通知
        $api->post('/suppliers', 'NotifyController@suppliers'); // 分账通商户开通通知
    });
    $api->get('/ums_return', 'UmsReturnController@umsReturn'); // 银联商务微信支付 同步返回通知
    $api->group(['middleware' => 'auth:finance'], function () use ($api) {
        // 权限相关
        $api->group(['prefix' => 'auth'], function () use ($api) {
            $api->delete('/', 'AuthController@destory'); // 销毁 token
            $api->get('info', 'AuthController@info'); // 登录后的详情
            $api->get('operate_sms', 'AuthController@operateSms'); // 发送操作验证码
        });
        $api->group(['prefix' => 'transfer'], function () use ($api) {
            $api->get('/', 'FinanceController@transferRecord'); // 转账记录
            $api->post('/', ['uses' => 'FinanceController@transfer', 'middleware' => 'validate_finance_operation_sms_captcha']); // 转账
        });
        $api->group(['prefix' => 'recharge'], function () use ($api) {
            $api->get('/', 'FinanceController@rechargeRecord'); // 充值记录
        });
        $api->group(['prefix' => 'suppliers'], function () use ($api) {
            $api->get('/', 'SupplierController@list'); // 供应商列表
            $api->patch('/status/{id}', 'SupplierController@status'); // 启用禁用
            $api->post('/', 'SupplierController@store'); // 新增供应商商户
        });
    });
});
